package router

import (
	_ "Im/docs"
	"Im/middlewares"
	"fmt"
	"github.com/gin-gonic/gin"
)

func Router() {
	r := gin.Default()
	//配置跨域
	r.Use(middlewares.Cors())
	//创建token路由分组
	auth := r.Group("/auth", middlewares.AuthCheck())
	//公共路由组
	PublicRouter(r.Group(""))

	//用户的路由组
	UserRouter(auth)
	//聊天的路由组
	MsgRouter(auth)

	err := r.Run(":8080")
	if err != nil {
		fmt.Println(err.Error())
		return
	}
}
